package com.csun.cmny.provider.device.watch.entity;

    /// <summary>
    ///  下行音量调整数据包
    ///  关联 上行确认 027
    ///  Downlink volume adjustment data packet
    /// Association confirmation command FunCode: 027
    /// </summary>
    public class C026
    {
        /// <summary>
        /// 数据起封包 @B#@ 
        /// Start Fixed value :@B#@ 
        /// </summary>
        public String HeadCode = "@B#@";
        /// <summary>
        /// 协议版本号
        /// Protocol version number
        /// </summary>
        public String Protocol = null;
        /// <summary>
        /// 功能代码识别
        /// Function code
        /// </summary>
        public final String FunCode = "026";
        /// <summary>
        /// 国际移动设备身份码
        /// International Mobile Equipment Identity
        /// </summary>
        public String IMEI = null;
        /// <summary>
        /// 音量大小 0-11，最大值为 11
        /// The volume is 0-11, and the maximum is 11
        /// </summary>
        public int Volume =0;
        /// <summary>
        /// 终端当前时间(年月日时分秒) yyyyMMddHHmmss
        /// The terminal current time ( format:yyyyMMddHHmmss)
        /// </summary>
        public String TerminalTime = null;
        /// <summary>
        /// 任务标识，用户自定义，方便回传标识
        /// Task identity, user custom, convenient return identification
        /// </summary>
        public String TaskId = null;
        /// <summary>
        /// 结尾封包 @E#@
        /// End packet @E#@
        /// </summary>
        public String FootCode = "@E#@";



        /// <summary>
        /// 初始化模型
        ///@B#@|01|026|111112222233333|9|20160715162720|0255BB90395C475E9D6155AF98B38387|@E#@
        /// </summary>
        /// <param name="cmdStr"></param>
        public C026(String cmdStr)
        {

        	String[] data = cmdStr.split("\\|");
            int dataLength = data.length;
            if (dataLength == 8 && "@B#@".equals(data[0]) && FunCode.equals(data[2]))
            {
                HeadCode = data[0];
                Protocol = data[1];
                IMEI = data[3];
                Volume = Integer.parseInt(data[4]);
                TerminalTime = data[5];
                TaskId = data[6];
                FootCode = data[7];
            }
        }

        public  String ToString()
        {
        	String rString = HeadCode + "|";
            rString += Protocol + "|";
            rString += FunCode + "|";
            rString += IMEI + "|";
            rString += Volume + "|";
            rString += TerminalTime + "|";
            rString += TaskId + "|";
            rString += FootCode;
            return rString;
        }
    }




